<?php
/**
 *  购物车
*/

namespace app\api\model;

class Carts extends BaseModel
{


    /**
     *  关联库存
    */
    public function inventory()
    {

        return $this->hasMany('Inventory')->where('status', 1)->where('view_count', '>', 100)->order('created_at', 'desc');

    }

    /**
     * 关联商品
     */
    public function product()
    {
        return $this->hasOne('Product','id','product_id');
    }

    /**
     * 关联仓库
    */
    public function warehouse()
    {
        return $this->hasOne('Warehouse','id','warehouse_id');
    }




}
